import request from "@/utils/request";
const statementApi = {
  /**
   * 客户报表
   *
   * @param queryParams 查询参数
   */
  getCustomerReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getCustomerReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 销售订单报表
   *
   * @param queryParams 查询参数
   */
  getSalesOrderReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getSalesOrderReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 销售订单产品报表
   *
   * @param queryParams 查询参数
   */
  getSalesProductReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getSalesProductReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 采购订单报表
   *
   * @param queryParams 查询参数
   */
  getPurchaseOrderReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getPurchaseOrderReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 采购订单产品报表
   *
   * @param queryParams 查询参数
   */
  getPurchaseProductReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getPurchaseProductReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 供应商报表
   *
   * @param queryParams 查询参数
   */
  getSupplierReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getSupplierReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 价格报表
   *
   * @param queryParams 查询参数
   */
  getProductPriceReport(queryParams: CustomerReportPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getProductPriceReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 储位报表
   *
   * @param queryParams 查询参数
   */
  getLocationReport(queryParams: locationPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getLocationReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 盘库报表
   *
   * @param queryParams 查询参数
   */
  getCheckReport(queryParams: locationPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getCheckReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 生产单报表
   *
   * @param queryParams 查询参数
   */
  getProductionReport(queryParams: locationPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getProductionReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 需求量报表
   *
   * @param queryParams 查询参数
   */
  getProdBomReport(queryParams: locationPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getProdBomReport?object=${query}`,
      method: "get",
    });
  },
  /**
   * 历史下载报表
   *
   * @param queryParams 查询参数
   */
  getReportHistory(queryParams: locationPageQuery) {
    let query = encodeURIComponent(JSON.stringify({ ...queryParams }));
    return request<any, any>({
      url: `/core/report/getReportHistory?object=${query}`,
      method: "get",
    });
  },
  downloadReport(data: any) {
    return request({
      url: `/core/report/downloadReport`,
      method: "post",
      data: data,
    });
  },
};
export default statementApi;
export interface CustomerReportPageQuery {
  // /** 汇总方式  day,week,month,quarter,year*/ 天限制不超过365
  timeType?: string;

  /** 时间范围 */
  // timeScopes?: string;
  startDate?: string | null;
  endDate?: string;
  // 产品code列表
  productCodes?: string[];
}
/**
 * 储位分页
 */
export interface locationPageQuery extends PageQuery {
  /** 储位code 盘库code 生产单code */
  code?: string;
  name?: string;
  // 开始时间
  startDate?: string | null;
  // 结束时间
  endDate?: string;
  // 盘库结果
  result?: string;
  /** 储位名 */
  warehouseName?: string;
  // 储位状态
  used?: string;
  // 生产状态
  status?: number;
  // 产品名称
  productName?: string;
  // 需求单全部code  生产单产品code
  productCode?: string;
  // 排序方式 1=按日期排序 2=按物料排序
  orderBy?: number;
  // 报表下载 1储位报表 2销售订单报表 3销售产品报表 4采购订单报表 5采购产品报表 6客户报表 7供应商报表 8盘点报表 9生产报表 10需求量
  reportType?: number;
}
